﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DQYT.HTDZ.DAL;
using DQYT.HTDZ.Model;
using System.Data;
using System.Collections;



namespace DQYT.HTDZ.BLL
{
    public class SkgysjbBLL
    {

        private SkgysjbDAL dal = new SkgysjbDAL();

        #region  Method

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(decimal ID)
        {
            return dal.Exists(ID);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(SkgysjbModel model)
        {
            return dal.Add(model);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SkgysjbModel model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(decimal ID)
        {

            return dal.Delete(ID);
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string IDlist)
        {
            return dal.DeleteList(IDlist);
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SkgysjbModel GetModel(Int32 ID)
        {

            return dal.GetModel(ID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }



        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            return dal.GetRecordCount(strWhere);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
        }

        

        #endregion  Method

        #region 新添加
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, int PageIndex, int pageSize)
        {
            return dal.GetListByPage(strWhere, PageIndex, pageSize);
        }

        public DataTable getSKGYSJBData(string userCode, string wellCode, int pageSize, int pageIndex, out int recordCount)
        {
            return dal.getSKGYSJBDataBySQL(userCode, wellCode, pageSize, pageIndex, out recordCount);
        }


        /// <summary>
        /// 初始化数据
        /// </summary>
        /// <param name="objSKGYSJB"></param>
        public void InitSKGYSJB(SkgysjbModel objSKGYSJB)
        {
            dal.InitSKGYSJB(objSKGYSJB);
        }

        /// <summary>
        /// 获得下一个ID值
        /// </summary>
        /// <returns></returns>
        public int GetNextID()
        {
            return dal.GetNextID();
        }
        /// <summary>
        /// 获得下一个ID
        /// </summary>
        /// <param name="FieldName">字段名</param>
        /// <returns></returns>
        public int GetNextID(string FieldName)
        {
            return dal.GetNextID(FieldName);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="objSKGYSJB"></param>
        public void SetValue(SkgysjbModel objSKGYSJB)
        {
            dal.SetValue(objSKGYSJB);
        }
        /// <summary>
        /// 判断当前字符变量是否为空，如果为空则返回“”，否则返回原字符
        /// </summary>
        /// <param name="NullObj"></param>
        /// <returns></returns>
        public string SetNotNull(string NullObj)
        {
            return dal.SetNotNull(NullObj);
        }

        public int SetNotNull(int NullObj)
        {
            return dal.SetNotNull(NullObj);
        }

        public double SetNotNull(double NullObj)
        {
            return dal.SetNotNull(NullObj);
        }


        /// <summary>
        /// 删除相关表记录
        /// </summary>
        /// <param name="IDlist">ID字符串</param>
        /// <returns></returns>
        public bool DeleteListAll(string IDlist)
        {
            return dal.DeleteListAll(IDlist);
        }


        /// <summary>
        /// 执行事务
        /// </summary>
        /// <param name="alSQL"></param>
        public void ExecuteSqlTran(ArrayList alSQL)
        {
            dal.ExecuteSqlTran(alSQL);
        }

        /// <summary>
        /// 更新测试日期
        /// </summary>
        /// <param name="strID">ID字符串，如：2,4,5</param>
        public int UpdateCSRQ(string strID)
        {
            return dal.UpdateCSRQ(strID);
        }
        /// <summary>
        /// 更新审核状态
        /// </summary>
        /// <param name="strID">ID字符串，如：2,4,5</param>
        public int UpdateSHZT(string strSQL)
        {
            return dal.UpdateSHZT(strSQL);
        }

        /// <summary>
        /// 更新施工后数据设计状态
        /// </summary>
        /// <param name="strID">ID字符串，如：2,4,5</param>
        public int UpdateSJZT(string ID)
        {
            return dal.UpdateSJZT(ID);
        }

        /// <summary>
        /// 更新射孔数据变更接收状态
        /// </summary>
        /// <param name="strID">ID字符串，如：2,4,5</param>
        public int UpdateSKOK(string ID)
        {
            return UpdateSKOK(ID);
        }
        /// <summary>
        /// 更新作业施工数据变更接收状态
        /// </summary>
        /// <param name="strID">ID字符串，如：2,4,5</param>
        public int UpdateZYOK(string ID)
        {
            return dal.UpdateZYOK(ID);
        }


        /// <summary>
        /// 获得结果记录数
        /// </summary>
        /// <param name="strSQL">统计sql</param>
        /// <returns></returns>
        public int GetResultNum(string strSQL)
        {
            return dal.GetResultNum(strSQL);
        }


        /// <summary>
        /// 通过审核
        /// </summary>
        /// <param name="IDlist">ID字符串</param>
        /// <returns></returns>
        public bool TGSH(string IDlist, string shr)
        {
            return dal.TGSH(IDlist, shr);
        }

        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="ID">ID号</param>
        /// <param name="OK">审核是否通过</param>
        /// <param name="SHWTGYY">未通过原因</param>
        /// <returns></returns>
        public bool SH(int ID, int OK, string SHWTGYY, string SHR)
        {
            return dal.SH(ID, OK, SHWTGYY, SHR);
        }

        /// <summary>
        /// 获得查询结果
        /// </summary>
        /// <param name="strSQL">查询 sql</param>
        /// <returns></returns>
        public DataTable GetData(string strSQL)
        {
            return dal.GetData(strSQL);
        }
        #endregion

#region 射孔项目添加

        public DataTable QuerySchemeDesignWell(string id, int pageSize, int pageIndex, out int recordCount)
        {
            return dal.QuerySchemeDesignWell(id, pageSize, pageIndex, out recordCount);
        }

        public DataTable QuerySchemeDesignWellByWellCode(string user_code, string wellCode, string strDateSpan, int pageSize, int pageIndex, out int recordCount)
        {
            return dal.QuerySchemeDesignWellByWellCode(user_code, wellCode,strDateSpan, pageSize, pageIndex, out recordCount);
        }

        public bool UpdateSchemeDesignWell(SkgysjbModel model)
        {
            return dal.UpdateSchemeDesignWell(model);
        }

        public DataTable QueryWellSchemeDesignByUser(string jh, string sjr, string beginDate, string endDate, int pageSize, int pageIndex, out int recordCount)
        {
            return dal.QueryWellSchemeDesignByUser(jh, sjr, beginDate, endDate, pageSize, pageIndex, out recordCount);
        }
        
#endregion
    }
}
